// main.c
// 使用操作系统接口模拟实现一下C库函数
#include "mystdio.h"
#include <unistd.h>

static char* myfile = "test.txt";

int main()
{
    _FILE* fp = _fopen(myfile, "w");
    if(fp == NULL) return 1;

    const char* msg = "Hello Linux\n";
    int cnt = 5;
    while(cnt--)
    {
        _fwrite(fp, msg, strlen(msg));
        sleep(1);
    }
    _fclose(fp);

    return 0;
}